var API = require('API');
module.exports = function(){
    return {
        restrict: 'E',
        scope:{
            data:'=ngModel',
            shop:'=',
            desc:'=',
            del:'=',
            delete:'&'
        },
        templateUrl:'/modules/admin/shops/shops.inc.html',
        replace: true,
        controller: ['$scope','$timeout', function($scope,$timeout){



            // 选择门店
            $scope.selected_shop = function(item){
                $scope.shop = item;
                
                if (item.iscolor) {
                    item.iscolor = false;
                } else {
                    for (var i = 0; i < $scope.data.length; i++) {
                        $scope.data[i].iscolor = false;
                    }
                    item.iscolor = true;
                }
            };

        }]
    }
};